package day06;

import java.util.Random;
import java.util.Scanner;

public class Day06TextMax {
    public static void main(String[] args) {
        Random rand = new Random();
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入共有几个随机数：");
        int max = getMaxOfArray(scan.nextInt());
        System.out.println("其中的最大值是："+max);
    }
    public static int  getMaxOfArray(int n){
        Random rand = new Random();
        Scanner scan = new Scanner(System.in);

        int max = 0;
        int [] arr = new int[n];
        for (int i=0;i<arr.length;i++){
            arr[i]= rand.nextInt(10)+1;
        }
        for (int i=0;i<arr.length;i++){
            if (arr[i]>max){
                max = arr[i];
            }
        }
        return max;
    }
}
